﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace sandbox
{
    class Program
    {
        public string Src { get; set; }
        static string Tokenize(ref string src)
        {
            string tmp = src.Replace('　',' ').Trim();
            if (string.IsNullOrEmpty(tmp))
            {
                tmp = null;
            } else {
                int pos = tmp.IndexOf(' ');
                if (pos < 0)
                {
                    src = string.Empty;
                }
                else
                {
                    src = tmp.Substring(pos);
                    tmp = tmp.Substring(0, pos);
                }
            }
            return tmp;
        }

        static void Main(string[] args)
        {
            string str = "  abc def   ghi  ";
            string token;
            while ((token = Tokenize(ref str)) != null)
            {
                Console.WriteLine("[{0}]", token);
            }
        }
    }
}
